import request from "@/utils/request";

// 查询部门列表
export function listDept(query) {
  return request({
    url: "/system/dept/list",
    method: "get",
    params: query,
  });
}

// 查询部门列表（排除节点）
export function listDeptExcludeChild(deptId) {
  return request({
    url: "/system/dept/list/exclude/" + deptId,
    method: "get",
  });
}

// 查询部门详细
export function getDept(deptId) {
  return request({
    url: "/system/dept/get?id=" + deptId,
    method: "get",
  });
}

// 获取部门精简信息列表
export function listSimpleDepts() {
  return request({
    url: "/system/dept/list-all-simple",
    method: "get",
  });
}

// 新增部门
export function addDept(data) {
  return request({
    url: "/system/dept/create",
    method: "post",
    data: data,
  });
}

// 修改部门
export function updateDept(data) {
  return request({
    url: "/system/dept/update",
    method: "put",
    data: data,
  });
}

// 删除部门
export function delDept(id) {
  return request({
    url: "/system/dept/delete?id=" + id,
    method: "delete",
  });
}

// 添加 工作地点
export function AddWorkPlace() {
  return request({
    url: "system/work-place/list",
    method: "get",
  });
}

// 部门迁移
export function getMove() {
  return request({
    url: "/system/dept/move",
    method: "post",
  });
}

// 排序交换
export function sortExchange(data) {
  return request({
    url: "/system/dept/sortExchange",
    method: "post",
    data: data,
  });
}

// 排序下移
export function sortMoveDown(data) {
  return request({
    url: "/system/dept/sortMoveDown",
    method: "post",
    params: data,
  });
}

// 排序上移
export function sortMoveUp(data) {
  return request({
    url: "/system/dept/sortMoveUp",
    method: "post",
    params: data,
    params: data,
  });
}

// 排序置底
export function sortToDown(data) {
  return request({
    url: "/system/dept/sortToDown",
    method: "post",
    params: data,
  });
}

// 排序置顶
export function sortToUp(data) {
  return request({
    url: "/system/dept/sortToUp",
    method: "post",
    params: data,
  });
}
